<?
$parent=$_POST['parent'];
$search=$_POST['txtsearch'];
$loaitin=$_GET['loaitin'];
$links="index.php?progid=6&loai=".$loai;
//if($home!=""){$links="index.php?progid=6&home=1";}

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="padding:10px">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td   width="6" height="6"><img src="images/j_crn_tl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_t_med.png" width="100%"></td>
            <td  width="6" height="6" ><img src="images/j_crn_tr_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="1" background="images/dot.png"></td>
            <td class="bg_title"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><img src="images/icon-48-menumgr.png" width="48" height="48" /></td>
                <td width="45%" class="mana_title"> <?=$stitlestring?></td>
                <td width="50%" align="center">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="65%">&nbsp;</td>
                      <td class="icon_style" ><a href="<?=$links?>&baiviet=them&loai=<?=$loai?>"><img src="images/icon-32-new.png" width="32" height="32" border="0"/><br />
                      Th&ecirc;m</a></td>
                      
                     <td class="icon_style"><a href="#" onclick="return doSaveJobs('<?=$links?>&baiviet=xoa&loai=<?=$loai?>','Vui lòng chọn một bản ghi từ danh sách bên dưới')" ><img src="images/icon-32-delete.png" width="32" height="32"  border="0"/><br />
                      X&oacute;a</a></td>
                      <td class="icon_style"><a href="#"><img src="images/icon-32-help.png" width="32" height="32"  border="0"/><br />
                      Tr&#7907; gi&uacute;p</a></td>
                    </tr>
                  </table>
                  </td>
              </tr>
            </table></td>
            <td width="1" background="images/dot.png"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="6" height="6" ><img src="images/j_crn_bl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_b_med.png" width="100%"></td>
            <td width="6" height="6" ><img src="images/j_crn_br_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="7"></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td   width="6" height="6"><img src="images/j_crn_tl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_t_med.png" width="100%"></td>
            <td  width="6" height="6" ><img src="images/j_crn_tr_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0" >
          <tr>
            <td width="1" background="images/dot.png"></td>
            <td bgcolor="#fbfbfb"><form id="frmdanhsach" name="frmdanhsach" method="post" action="">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><?php 
						//echo $loai;
						$strsql="select * from tbloaitin where  phanloai_id=$loai and loaitin_parent=0 and loaitin_trangthai=1 order by loaitin_id desc";
			 $strAction="";
			$name='parent';?>
                    <select size="1" name="<?php echo $name?>"  onchange= "<?php echo $strAction?>"  >
                      <?php 
			 $qr1=mysql_query($strsql);
			   ?>
                      <option value="" >Tất cả <?=$titloaitin?></option>
                      <?php while($row=mysql_fetch_array($qr1))
			{
			?>
                      <option value="<?php echo $row['loaitin_id']?>" <? if($parent==$row['loaitin_id']){?> selected="selected"<? }?>><?php echo $row['loaitin_tieude']?></option>
                      <?php
			$bien=$row['loaitin_id'];
			$bienten=$row['loaitin_tieude'];
            caccaptin($bien,$bienten,$parent);
			
		 } ?>
                    </select>
                    <label>
                      <input type="text" name="txtsearch" id="txtsearch" value="<?=$search?>" />
                      <input type="submit" name="button" id="button" value="Tìm kiếm" />
                    </label></td>
                </tr>
                <tr>
                  <td style="padding:7px"><table width="100%" border="1" cellspacing="0" cellpadding="0" class="list_border">
                    <tr>
                      <td width="5%" class="list_title">#</td>
                      <td width="5%" class="list_title"> <input type="checkbox" name="chkAll" id="chkAll"  value="" onclick="CheckUncheckAll();" /></td>
                      <td width="32%" class="list_title">T&ecirc;n</td>
                      <td width="21%" class="list_title"><?=$titloaitin?></td>
                      <td width="12%" class="list_title">&#272;&atilde; &#273;&#432;&#7907;c b&#7853;t</td>
                      <td width="11%" class="list_title">Ngày tạo</td>
                      <td width="6%" class="list_title">ID</td>
                    </tr>
                    <? 					
	$sqlstring="select * from tbtintuc where  tintuc_id >0 and lang_id='$lang' ";	
	if($parent!=""){$sqlstring.=" and loaitin_id='$parent'";}
	if($search!=""){$sqlstring.=" and (tintuc_tieude like '%$search%' or tintuc_tomtat like '%$search%' or tintuc_noidung like '%$search%' )";}
	//if($loai!=""){$sqlstring.=" and loaitin_id in (select loaitin_id from tbloaitin where loaitin_trangthai=1 and phanloai_id='$loai' )";}
	if($loai!=""){$sqlstring.="and tintuc_phanloai='$loai'";}
	$qr12=mysql_query($sqlstring);
	$n_record=mysql_num_rows($qr12); 
	$p=$_SESSION['page'];
	$n=$_GET['n'];
	//echo $sqlstring;
	include 'phantrang.php';
	////////////////////////////////////////////////////
	$sqlstring.=" order by tintuc_id desc";
	if ($n!='all'){	$sqlstring.=" limit $s,$p";	 }
	$qr1=mysql_query($sqlstring); 
	$i=0;
	while($row=mysql_fetch_array($qr1)) 
	{ $i=$i+1;
	$tocha=catchinfor($row['loaitin_id'],"loaitin_id","loaitin_tieude","tbloaitin");
	$ids=$row['tintuc_id'];	
	$alias=make_title_furl($row["tintuc_tieude"]);
	//mysql_query("update tbtintuc SET  tintuc_alias='$alias' where tintuc_id='$ids'");
	/*
	$ids=$row['tintuc_id'];	
	$parent=$row['loaitin_id'];
	if($parent>0)
	{
		///////////////////////////////////////////
		$caseid= findcase($parent,"loaitin_id",$label);
		$casealias= findcase($parent,"loaitin_alias",$label);
		$casetieude= findcase($parent,"loaitin_tieude",$label);
		///////////////////////////////////////////
		mysql_query("update tbtintuc SET  tintuc_caseid='$caseid' , tintuc_casealias='$casealias' , tintuc_casetieude='$casetieude' where tintuc_id='$ids'");
		echo $casetieude;
	}
*/
  ?>
                    <tr  onmouseover="this.bgColor='#ffffdd'" onmouseout="this.bgColor=''" >
                      <td align="center" style="height:30"><?=$i?></td>
                      <td align="center">
                      <input type="checkbox" name="industry<?=$i?>" id="industry<?=$i?>"  value="<?=$row[tintuc_id]?>"/></td>
                      <td class="link-edit"><a href="<?=$links?>&baiviet=sua&id=<?=$row[tintuc_id]?>&loai=<?=$loai?>"><?=$row[tintuc_tieude]?></a></td>
                      <td><?=$tocha?></td>
                      <td align="center"><? if($row[tintuc_trangthai]==1){?><img src="images/tick.png" /><? }else{?><img src="images/publish_x.png" /><? }?></td>
                      <td><?=$row[tintuc_ngay]?></td>
                      <td align="center"><?=$row[tintuc_id]?></td>
                    </tr>
<? }?>
                  </table></td>
                </tr>
                <tr>
                  <td><? view_page($links); ?></td>
                </tr>
              </table>
              <input type="hidden" name="count" id="count" value="<?=$i?>"  />
                        </form>
            </td>
            <td width="1" background="images/dot.png"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="6" height="6" ><img src="images/j_crn_bl_med.png" width="6" height="6" /></td>
            <td  background="images/j_crn_b_med.png" width="100%"></td>
            <td width="6" height="6" ><img src="images/j_crn_br_med.png" width="6" height="6" /></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</td>
  </tr>
</table>
